﻿<!--#INCLUDE FILE="config.asp"-->
<!--#include virtual ="/Email/email.asp"-->
<%
if(Session("AdminAccessLevel") <> 1 and Session("AdminAccessLevel") <> 3) then
	Response.Redirect("admin-login.asp?msg=invalid")
end if
Dim attachment

if (request("emailto") <> "") then 
	emailto = request("emailto")
	subject = request("subject")
	content = request("content")
	guestid = request("guestid")
	nameGuest = request("nameGuest")
	attach = request("attach")
end if	
		Dim FEiEmail

		FEiEmail="fulfillment@feifinancial.com"
		
		'send mail
		
		From = "fulfillment@feifinancial.com"
		FEiEmail = FEiEmail & ";" & emailto
		
		if (attach = "English") then
			Call EmailCdonts(From,FEiEmail,"",subject,content ,0,""&Server.MapPath("CartaAutorizacionCargoTarjetaENGLISH xls.pdf"),2)
		elseif (attach = "Espanol") then
			Call EmailCdonts(From,FEiEmail,"",subject,content ,0,""&Server.MapPath("CartaAutorizacionCargoTarjetaESPAÑOL.xls.pdf"),2)
		else
			Call EmailCdonts(From,FEiEmail,"",subject,content ,0,"",2)
		end if
		'On Error Resume Next 
			

		If Err.Number <> 0 Then
		Dim output
		  output = "This means there is most likely a problem with the" & vbCrLf
		  output = output + """ConnectionString"" info that you specified.<br>" & vbCrLf
		  response.write output
		Else
			set objConnect = server.createObject("ADODB.Connection")       
			objConnect.open conStr

			Set oCmd = Server.CreateObject("ADODB.Command")

			oCmd.ActiveConnection = objConnect
			oCmd.CommandText = "sp_send_mail_guest" 
			oCmd.CommandType = 4
			
			Set content = oCmd.CreateParameter("@content", 200,1,3000, content)
			oCmd.Parameters.Append content
			
			Set guestid = oCmd.CreateParameter("@guestid", 3,1,100, guestid)
			oCmd.Parameters.Append guestid
			
			Set userid = oCmd.CreateParameter("@userid", 3,1,100,session("AdminId"))
			oCmd.Parameters.Append userid

			set rss = oCmd.execute
			
			Response.Write("Send Successfully! Click <a href=""admin-dashboard.asp"">here</a> to redirect Dashboard")
		end if
%>